%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A function to generate 2D golden-angle radial trajectory
% Used for GROG recon only

%Li Feng, NYU, 12/18/2017

function Traj=Trajectory_GoldenAngle_GROG_N(ntviews,nx,N);

tau = (1.0+sqrt(5.0))/2.0;
golden_angle = pi / (tau+N-1);
a=180/golden_angle;

radian=mod((0:a:(ntviews-1)*a)*pi/180,2*pi);
radian = mod(0:golden_angle:(ntviews-1)*golden_angle,pi*2);
% Rho=[-floor(nx/2):floor(nx/2)];
Rho = -nx/2:1:nx/2-1;

% Rho=Rho(1:nx)+0.5;
% Rho=linspace(-(nx/2),nx/2,nx);

for jj=1:size(radian,2)
    X(:,jj)=Rho*sin(radian(1,jj));
    Y(:,jj)=-Rho*cos(radian(1,jj));
end

Traj=X+i*Y;
return